package com.niit.controller;


import com.niit.model.Student;
import com.niit.service.InformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "学生模块",tags = {"学生模块"})
@RestController
public class InformationController{

        @Autowired
        private InformationService informationService;
        @ApiOperation("根据ID查询学生信息")
        @GetMapping("/student/{id}")
        public Student getStudentById(@PathVariable("id")Long id){
            return   informationService.selectStudentById(id);
        }

        @ApiOperation("更新学生信息")
        @PutMapping("/student")
        public String update(@RequestBody Student student){
            return informationService.upStudent(student) > 0 ? "success" : "fail";
        }
}